package org.thingsboard.server.utils.msg;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.UUID;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class MqttReqMsgHeader {

    // 消息id
    private String msgId;

    // 消息类型
    private String msgType;

    // 消息时间戳
    private Long timestamp;

    // 网关id
    private String gatewayId;

    // 边缘代理id
    private String agentId;

    public MqttReqMsgHeader(MsgType msgType,String gatewayId,String agentId){
        this.msgId = UUID.randomUUID().toString().replaceAll("-","");
        this.msgType = msgType.msgTypeValue();
        this.timestamp =System.currentTimeMillis();
        this.gatewayId = gatewayId;
        this.agentId = agentId;
    }
}
